package design_modle.factory;

public class CashReturn extends CashSuper{
    private double moneyOConditon = 0;
    private double moneyReturn = 0;

    public CashReturn(double moneyOConditon, double moneyReturn) {
        this.moneyOConditon = moneyOConditon;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        double res = money;
        if(money >= moneyOConditon) {
            res = money - Math.floor(money/moneyOConditon)*moneyReturn;
        }
        return res;
    }
}
